<template>
  <div>{{ obj }}</div>
  <span>{{ obj.age }}</span>
  <button @click="obj.age++">加1111</button>
</template>

<script>
import { reactive, toRefs } from "vue";
export default {
  setup() {
    const obj = reactive({
      name: "张三",
      age: 18,
    });
    // const {name,age} =  toRefs(obj)
    // 或者
    // toRefs作用是把响应式对象的每个属性都变成独立响应的对象
    return { ...toRefs(obj), obj };
  },
};
</script>

<style>
</style>